$().ready(function(){
	
	$baseUrl = $("#baseUrl").text();
	
	var allReady=false,
	tuReady=false,
	rbReady=false;
	
	$.ajax({
		url: $baseUrl + '/index/activitiesajax',
		type: 'post',
		dataType: 'json',
		async: true,
		data: ({}),
		success: function(data) {					
		$(".activities").hide().prepend(data.content).slideDown();		
		$("#totalBooks a").text(data.totalBooks);	
		
	}}); 
	
	$.ajax({
		url: $baseUrl + '/index/topusersajax',
		type: 'post',
		dataType: 'json',
		async: true,
		data: ({}),
		success: function(data) {					
		$(data.content).insertAfter("#blogRssUl");	
		tuReady=true;
		CheckAllReady();
	}}); 
	
	$.ajax({
		url: $baseUrl + '/index/randombooksajax',
		type: 'post',
		dataType: 'json',
		async: true,
		data: ({}),
		success: function(data) {					
		$(data.content).insertBefore("#tFollowUs");	
		rbReady=true;
		CheckAllReady();
	}}); 
	
	function CheckAllReady(){

		if (rbReady && tuReady) {
		$("[title]").not(".defaultText").style_my_tooltips({
			 tip_follows_cursor: "on", //on/off
			 tip_delay_time: 1000 //milliseconds
			});  
		}
	}
	
	
});